#!/usr/bin/perl -w
chomp(my @flines = `ls wg*.broadPeak`);
#parse the information about the run out of the broadPeak file.
foreach my $fline (@flines) {
  my $cell_and_feature = '';
  if($fline =~ /wgEncodeBroadChipSeqPeaks(\w+)\.broadPeak/) { $cell_and_feature = $1; }
  else { die; }
  my $cell;
  my $feature;
  if($cell_and_feature =~ /^(\S+)([HCP].*)/) {
    $cell = $1; 
    $feature = $2; 
  }
  print "$cell\t$feature\n";
  `./process_generic_overlay_before_liftover.pl $fline hg18 hg18 $cell $feature`;
  `cp /tmp/before_liftover.bed /tmp/after_liftover.bed`; # this we don't need to do
  `./process_generic_overlay_after_liftover.pl`;
}

#foreach my $fline (@flines) {
#  print "$fline\n";
#}
